feat: enhance user profile handling with Perfil enum and feature flags#39
Merged
feat: enhance user profile handling with Perfil enum and feature flags#39
Conversation
Member
Im-Fran
commented
Mar 16, 2026
- Modifica los feature flags para filtrar widgets usando perfiles
- Limitar vista de datos a los profesores, ya que no poseen asignaturas o clases asignadas (como los estudiantes)
- Limita BottomNavBar (Asignaturas) a estudiantes nada más.
- Guarda estudiante en cache en AuthService
- Evita cargar cosas si el perfil no es de estudiante
Contributor
There was a problem hiding this comment.
Pull request overview
Este PR introduce control por perfil de usuario (Perfil) para habilitar/ocultar funcionalidades (UI y cargas de datos) y agrega una caché en memoria del usuario autenticado para permitir evaluaciones síncronas (p. ej. en feature flags y navegación).
Changes:
- Extiende
FeatureFlagpara soportar restricciones porPerfil(incluye constructorFeatureFlag.profilesy fallback opcional). - Restringe secciones y accesos rápidos (Horario/Clases de hoy/Asignaturas en curso) solo a
Perfil.estudiante, y limita “Asignaturas” en el BottomNavBar a estudiantes. - Agrega caché en memoria del
EstudianteenAuthServicepara decisiones de UI basadas en perfil sinawait.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/widgets/feature_flag.dart | Añade restricción por perfiles y evaluación síncrona basada en AuthService.cachedEstudiante. |
| lib/styles/navigation/bottom_navbar.dart | Filtra items de navegación por feature flag y perfil (Asignaturas solo estudiantes). |
| lib/core/models/navigation/navigation_item.dart | Agrega perfiles a los items de navegación. |
| lib/core/models/user/perfil.dart | Mejora enum Perfil y añade displayName. |
| lib/core/services/auth_service.dart | Implementa caché en memoria del usuario logueado. |
| lib/screens/home/home_screen.dart | Oculta “Clases de hoy” a no-estudiantes y evita cargar horario según perfil. |
| lib/screens/home/widgets/acceso_rapido.dart | Restringe acceso rápido “Horario” a estudiantes. |
| lib/screens/asignaturas/lista_asignaturas_screen.dart | Evita cargar asignaturas si el usuario no es estudiante y limita sección “en curso”. |
| lib/screens/asignaturas/widgets/acceso_rapido.dart | Restringe accesos rápidos (Horario/Malla Histórica) a estudiantes. |
| lib/screens/notas/notas_screen.dart | Evita cargar asignaturas con notas si el perfil no es estudiante. |
| lib/screens/profile/widgets/profile_header.dart | Ajusta lógica de carrera a estudiantes y oculta el bloque de carrera según perfil. |
| lib/screens/profile/profile_screen.dart | Ajusta llamada a ProfileHeader tras renombrar parámetro. |
| lib/screens/credencial/credencial_screen.dart | Restringe el bloque principal de credencial a estudiantes/profesores. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.